]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: listen actively to windows being destroyed during WS switch
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 6 Sep 2018 19:50:21 +0000 (21:50 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 11 Sep 2018 14:32:33 +0000 (14:32 +0000)
Prevents gjs from dealing with already dispose()d objects.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/539
js/ui/windowManager.js

index b6627e253543be18a9fe3e5351777a866017da06..2295e301019bd0cfa226631f16ee46b2f2547453 100644 (file)
@@ -1910,6 +1910,14 @@ var WindowManager = new Lang.Class({
                 actor.visible = visible;
             }
         }
+
+        for (let i = 0; i < switchData.windows.length; i++) {
+            let w = switchData.windows[i];
+
+            w.windowDestroyId = w.window.connect('destroy', () => {
+                switchData.windows.splice(switchData.windows.indexOf(w), 1);
+            });
+        }
     },
 
     _finishWorkspaceSwitch(switchData) {
@@ -1917,9 +1925,8 @@ var WindowManager = new Lang.Class({
 
         for (let i = 0; i < switchData.windows.length; i++) {
             let w = switchData.windows[i];
-            if (w.window.is_destroyed()) // Window gone
-                continue;
 
+            w.window.disconnect(w.windowDestroyId);
             w.window.reparent(w.parent);
 
             if (w.window.get_meta_window().get_workspace() !=